
import { _decorator, Component, Node, SkeletalAnimation } from 'cc';
import { GameContrl } from './GameContrl';
const { ccclass, property } = _decorator;

@ccclass('Player')
export class Player extends Component {

    static instance: Player;

    @property speed: number = 0;

    public curPosZ = 0;

    public isDeath = false;

    onLoad() {
        //访问静态属性只能从类顶层访问
        Player.instance = this;
    }


    update(dt: number) {
        //一直改变猫z方向的位置
        // GameContrl.instance.isDeath =
        this.node.setPosition(this.node.getPosition().add3f(0, 0, dt * this.speed))
        this.curPosZ = this.node.getPosition().z;
    }




}

